package cn.zc.student.service.service.impl;

import cn.tools.dozer.config.DozerUtils;
import cn.zc.student.entity.Dto.StudentExaminationResultDto;
import cn.zc.student.entity.StudentExaminationResult;
import cn.zc.student.service.mapper.StudentExaminationResultMapper;
import cn.zc.student.service.service.StudentExaminationResultService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * <p>
 * 考试成绩 服务实现类
 * </p>
 *
 * @author keno
 * @since 2022-02-23
 */
@Service
public class StudentExaminationResultServiceImpl extends ServiceImpl<StudentExaminationResultMapper, StudentExaminationResult> implements StudentExaminationResultService {

    @Resource
    private DozerUtils dozerUtils;

    @Override
    public StudentExaminationResultDto findStudentExaminationResult(String classifyId, String studentId) {
        StudentExaminationResult one = getOne(new QueryWrapper<StudentExaminationResult>().lambda()
                .eq(StudentExaminationResult::getStudentId, studentId).eq(StudentExaminationResult::getExaminationClassifyId, classifyId)
        );
        return dozerUtils.map(one,StudentExaminationResultDto.class);
    }
}
